package com.yzt.plugin_imageloader.trans;

import android.content.Context;
import android.graphics.Bitmap;

import androidx.annotation.NonNull;

import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.yzt.p_base.utils.BlurBitmapUtil;

import java.security.MessageDigest;

/**
 * author : bob
 * date   : 2022/11/29
 * desc   : 高斯处理
 */
public class GlideBlurTransformation extends CenterCrop {

    private final Context context;

    public GlideBlurTransformation(Context context) {
        this.context = context;
    }

    @Override
    protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) {
        // 设置渲染的模糊程度, 25f是最大模糊度
        return BlurBitmapUtil.instance().blurBitmap(context, toTransform, 5, outWidth, outHeight);
    }

    @Override
    public void updateDiskCacheKey(MessageDigest messageDigest) {

    }
}
